package com.kanshu.ksgb.fastread.doudou.module.login.adapter;

import android.content.Context;

import com.dl7.recycler.adapter.BaseQuickAdapter;
import com.dl7.recycler.adapter.BaseViewHolder;
import com.kanshu.ksgb.fastread.doudou.R;
import com.kanshu.ksgb.fastread.doudou.module.login.bean.ChargeBean;

import java.util.List;

/**
 * Created by wcy on 2017\6\23 0023.
 */

public class ChargeAdapter extends BaseQuickAdapter<ChargeBean> {
    public ChargeAdapter(Context context) {
        super(context);
    }

    public ChargeAdapter(Context context, List<ChargeBean> data) {
        super(context, data);
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.item_charge_layout;
    }

    @Override
    protected void convert(BaseViewHolder holder, ChargeBean item, int position) {

        switch (Integer.valueOf(item.pay_type)){
            case ChargeBean.TYPE_SOURCE_ALIPAY:
                holder.setImageResource(R.id.source_icon,R.mipmap.ic_alipay);
                break;
            case ChargeBean.TYPE_SOURCE_WECHAT:
                holder.setImageResource(R.id.source_icon,R.mipmap.ic_wechat);
                break;
        }


        holder.setText(R.id.date, item.create_time)
        .setText(R.id.rmb, item.total_fee + "元");
        if (item.business_type == ChargeBean.TYPE_NORMAL) {
            holder.setText(R.id.coin_info, "+" + item.coin + "金币");
        } else if (item.business_type == ChargeBean.TYPE_DAY_PAYMENT) {
            holder.setText(R.id.coin_info, "包天");
        } else if (item.business_type == ChargeBean.TYPE_AD) {
            holder.setText(R.id.coin_info, "免广告");
        } else if (item.business_type == ChargeBean.TYPE_GIVE) {
            //holder.setText(R.id.coin_info, "赠送" + item.total_fee + "金币");
        }
    }
}
